﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Configuration;
using Microsoft.SharePoint;

namespace PaulBeck.Timesheet
{
    public static class CommonWFE
    {

        public static string GetTimesheetEditUrl()
        {
            ///Pages/Timesheet-Add-or-Edit.aspx
            return ConfigurationSettings.AppSettings["TimesheetEditUrl"];
        }

        public static string GetTimesheetAdminClientUrl()
        {
            return ConfigurationSettings.AppSettings["TimesheetAdminClientUrl"];
        }

        public static string GetTimesheetAdminProjectUrl()
        {
            return ConfigurationSettings.AppSettings["TimesheetAdminProjectUrl"];
        }

        public static string GetTimesheetAdminProjectResourceUrl()
        {
            return ConfigurationSettings.AppSettings["TimesheetAdminProjectResourceUrl"];
        }

        public static string CurrentUserName()
        {
            return SPContext.Current.Web.CurrentUser.Name;
        }

        public static string CurrentUserLoginName()
        {
            return SPContext.Current.Web.CurrentUser.LoginName;
        }

        public static double GetTimesheetWorkDayLength()
        {
            try
            {
                return Convert.ToDouble(ConfigurationSettings.AppSettings["TimesheetDayLength"]);
            }
            catch (Exception ex)
            {
                return 0;
            }
        }

    }
}
